<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAdminActionlogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_actionlog', function (Blueprint $table) {
            // 表引擎
            $table->engine = 'MyISAM';
            $table->charset = 'utf8';
            $table->collation = 'utf8_unicode_ci';
            $table->increments('id')->comment('编号id');
            $table->integer('log_uid')->comment('管理员id');
            $table->string('log_name', 20)->comment('管理员账号');
            $table->string('log_true_name', 20)->nullable()->comment('姓名');
            $table->string('log_module', 50)->comment('操作模块');
            $table->string('log_type', 10)->default('add')->comment('操作状态:add、新增，edit、修改，delete、删除');
            $table->text('log_remark')->comment('操作内容');
            $table->integer('log_time')->default(0)->comment('操作时间');
            $table->string('log_ip', 40)->default(0)->comment('操作ip');
        });
        $db_prefix = env('DB_PREFIX');
        DB::statement("ALTER TABLE {$db_prefix}admin_actionlog comment '后台操作日志表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_actionlog');
    }
}
